<template>
    <InjectCompoment />
</template>

<script>

import { provide ,ref} from 'vue'
import InjectCompoment from './InjectCompoment.vue'
// 依赖注入对象
function updateLocation() {
    console.log('locationFunc call') // hello!
}

const location = ref('North Pole')
export default {
    components: { InjectCompoment },
    setup() {
        provide('message', 'hello!')
        provide(/* 注入名 */ 'location', { location, updateLocation })
    },
    beforeCreate() {
        provide('message', 'hello!')
        provide(/* 注入名 */ 'location', { location, updateLocation })
    },
}

</script>
